Publish SPA2 configuration values as sensors for seplos_bms_v3_ble#238
Merged
Conversation
2958538 to
b4fe72f
Compare
decode_spa2_data_ (System Parameters, registers 0x1335-0x1369) previously only logged its configuration values. Expose 8 of them as sensors: discharge over-temperature, environment under-temperature and MOSFET over-temperature protection, balancing open voltage/difference, SOC low alarm, and the inverter charge/discharge current limits. Rated/total capacity (0x1358/0x1359) stay log-only since they are already published via EIA. Values are published directly via the existing reg()/temperature() getters; the now-redundant ESP_LOGD lines are dropped. Decoding is covered against the existing real SPA_DATA_2 capture.
b4fe72f to
c19ddbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
decode_spa2_data_parses the second System-Parameters block (0x1335–0x1369, function0x04) but previously only logged its configuration values. This exposes 8 of them as ESPHome sensors. Register layout per XZH BMS Modbus-RTU Protocol, values verified against the realSPA_DATA_2capture (SG16S200A-SP57B-A):discharge_overtemperature_protectionenvironment_undertemperature_protectionmosfet_overtemperature_protectionbalancing_start_voltagebalancing_start_differencelow_state_of_charge_alarminverter_charge_current_limitinverter_discharge_current_limitRated/total capacity (
0x1358/0x1359) stay log-only — they are already published via the EIA block.Changes
seplos_bms_v3_ble.h: 8 newsensormembers and settersseplos_bms_v3_ble.cpp:publish_state_calls indecode_spa2_data_via the existingreg()/temperature()getters; the now-redundantESP_LOGDlines are droppedsensor.py: 8 newSENSOR_DEFSentriesseplos_bms_v3_ble_test.cpp: 4 new tests (temperature thresholds, balancing parameters, capacity/current config, null-sensor safety) againstSPA_DATA_2test_component_schemas.py, example YAML updatedTesting
pre-commit run --all-files— all hooks pass./run-cpp-tests.sh seplos_bms_v3_ble seplos_bms_v3_ble_pack— 34/34 pass, incl. the 4 new SPA2 tests